package com.alipay.app.groupmeal.standard.ui.b.function.result;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.Nullable;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.alipay.app.groupmeal.standard.R;
import com.alipay.app.groupmeal.standard.widget.ActionButton;
import com.alipay.app.groupmeal.standard.widget.CustomFitViewTextView;
import com.alipay.app.groupmeal.standard.widget.business.BaseBScreenView;
import com.chad.library.adapter.base.BaseQuickAdapter;

public class BScreenSuccessResult extends BaseBScreenView {

    private ImageView iv_icon;
    private TextView tv_title;
    private CustomFitViewTextView tv_amount;
    private RecyclerView recycler;
    private LinearLayout ll_amount;
    private ActionButton btn_action;
    private TextView tv_time;

    public BScreenSuccessResult(Context context) {
        super(context);
    }

    public BScreenSuccessResult(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    protected int getLayoutId() {
        return R.layout.view_pay_success;
    }

    @Override
    protected void initView(View view) {
        iv_icon = findViewById(R.id.iv_icon);
        tv_title = findViewById(R.id.tv_title);
        tv_amount = findViewById(R.id.tv_amount);
        recycler = findViewById(R.id.recycler);
        ll_amount = findViewById(R.id.ll_amount);
        btn_action = findViewById(R.id.btn_action);
        tv_time = findViewById(R.id.tv_time);
        recycler.setLayoutManager(new LinearLayoutManager(getContext()));
    }

    @Override
    protected void initData() {

    }

    public void setTitleName(String title) {
        tv_title.setText(title);
    }

    public void setIcon(boolean isAlipay) {
        if (isAlipay) {
            iv_icon.setBackgroundResource(R.mipmap.ic_alipay_white);
        } else {
            iv_icon.setBackgroundResource(R.mipmap.ic_hook_white);
        }
    }

    public void setAmountVisible(int visible) {
        ll_amount.setVisibility(visible);
    }

    public void setTime(String time) {
        tv_time.setText(time);
    }

    public void setAmount(String amount) {
        tv_amount.setText(amount);
    }

    public void setActionButton(String actionName) {
        btn_action.setActionName(actionName);
    }

    public void setRecyclerAdapter(BaseQuickAdapter adapter) {
        recycler.setFocusable(false);
        recycler.setAdapter(adapter);
    }
}
